<template>
  <el-input v-model="formValue" v-bind="$attrs" v-on="$listeners">
    <template
      slot="prepend"
      v-if="$attrs.__slot__ && $attrs.__slot__.prepend"
      >{{ $attrs.__slot__.prepend }}</template
    >
    <template slot="append" v-if="$attrs.__slot__ && $attrs.__slot__.append">{{
      $attrs.__slot__.append
    }}</template>
  </el-input>
</template>

<script>
export default {
  name: "form-input",

  model: {
    prop: "value", // 绑定的值，通过父组件传递
    event: "update",
  },
  props: {
    value: {
      type: [String, Number],
      default: "",
    },
  },
  computed: {
    formValue: {
      get() {
        return this.value;
      },
      set(val) {
        this.$emit("update", val);
      },
    },
  },
};
</script>

<style lang="scss" scoped></style>
